************
INTRODUCTION
************

This file describes how to set up and use the PHP wrapper code with Melissa DATA's Phone Object.


*************
PREREQUISITES
*************

To make use of the Phone Object PHP wrapper you will need:

* An installation of a PHP. Wrapper tested with PHP 5.2.6.

* The Melissa DATA Phone Object library and data files installed.
  These files are installed automatically if you run setup.exe. By default, the Phone Object 
  Library (mdPhone.dll) is installed in:
	C:\Program Files\Melissa DATA\DQT\PhoneObj\dll_32bit
* 64bit version available in C:\Program Files\Melissa DATA\DQT\PhoneObj\dll_64bit

  and the Phone Object data files in:
	C:\Program Files\Melissa DATA\DQT\Data

Note: For PHP 5.3.X

Current SWIG source file mdPhonePHPWrapper.cpp on the disk file is not compatible with PHP Version 5.3.x. SWIG wrapper were compiled using PHP 5.2.x.
In Php 5.2.x, SWIG wrappers use zend_error_noreturn() function which is no longer available in PHP 5.3.x. To create compatible mdPhonePHPWrapper.dll with Php 5.3.x, you need to make changes in mdPhonePHPWrapper.cpp manually. Open mdPhonePHPWrapper.cpp in text pad and replace all
zend_error_noreturn with zend_error. After making changes in mdPhonePHPWrapper.cpp compile wrapper again using CreateDll.bat file.


You will need to know the location of these items in order to install and run the PHP wrapper.


**********************
Wrapper compatibility
**********************

If the provided pre-compiled wrappers are not compatible with your environment, the necessary files for compilation can be found in the 'interfaces' folder of the object's main directory.


***********
Demo Mode
***********

Without a valid license string, Phone Object will function in Demo mode. While in Demo mode, Phone
Object will only validate in Nevada. Please contact your sales representative to obtain a 
fully functional license string. Please call 1-800-MELISSA ext. 3 for more information.


*************
Installation
*************

Copy the entire folder that contains this readme.txt into a local directory on your computer.


*****
Files
*****

Here is a brief overview of the files contained in the sample.

PhoneSample.php is a script sample that you can run from the command line. 
PhoneObjectPHPSample.php is a php webpage that you can host on a local webserver. 
mdPhonePHPWrapper.php is a php file that is called by the sample code. This file will load the 
	php_mdPhonePHPWrapper.dll extention.
php_mdPhonePHPWrapper.dll is the php extention.
mdPhone.dll is the Phone Object engine, not present in this directory. However, you may need a
	copy of this dll, which is installed to C:\Program Files\Melissa DATA\COM Objects\PhoneObj
	by default.

*****
Setup
*****

1. You will need to tell PHP where to load the php_mdPhonePHPWrapper.dll extension. 
   To do so, you can do one of the following:
	
	Copy php_mdPhonePHPWrapper.dll to your PHP extention folder, usually 
	"C:\Program Files\PHP\ext" by default

	or

	Alter the php extension folder by changing php.ini.
		extension_dir ="C:\Program Files\PHP\ext"

2. If you are using the sample script PhoneSample.php:

	Open a command window. 

	Adding the directory containing mdPhone to your PATH environment variable. 
	ex: set PATH=%PATH%;"C:\Program Files\Melissa DATA\DQT\PhoneObj\dll_32bit"

	type "php PhoneSample.php" to execute the script

3. If you are using the web page sample PhoneObjectPHPSample.php:

	Copy PhoneObjectPHPSample.php and mdPhonePHPWrapper.php to your webserver (ie: C:\Inetpub\wwwroot)

	Copy mdPhone.dll into the PHP directory (usually C:\Program Files\PHP) or the same directory as
	mdPhonePHPWrapper.php.
	
	Open up the sample in a browser (IE: http://localhost/PhoneObjectPHPSample.php)



**************************
Setting up the Sample Code
**************************

Open PhoneSample.php for editing. You must set the a license string that you receive from your Melissa Data
	#Put License and Directory of Phone Object Data Files here
	$License = "License Here";
	$DataPath = "C:\Program Files\Melissa DATA\DQT\Data";

For PhoneObjectPHPSample.php, you must do the sample thing and set the License and DataPath:
	//******************************************************//
	//Put License String and Path to Phone Object Data Files//
	//******************************************************//
	$License="License Here";
	$DataPath="C:\Program Files\Melissa DATA\DQT\Data";

*******
Updates
*******

The files generated/included in this wrapper do not need to be changed for DQ Suite updates unless there is a method signature change in the object. If a new method is added, you will need to rebuild the wrapper to use the new method. 

****
Note
****

Here are some general solutions if you run into problems:

Q. I get an error saying "Unable to load dynamic library. The Specified module cannot be found"
A. This means that either mdPhonePHPWrapper.php cannot find php_mdPhonePHPWrapper.dll, or php_mdPhonePHPWrapper.dll 
cannot find mdPhone.dll. Make sure to follow all the instructions in the Setup section above. 

Q. I get an error saying "Unable to load dynamic library. Access is denied"
A. This means that either PHP or your webserver does not have the correct permissions to access mdPhone.dll or 
php_mdPhonePHPWrapper.dll. Make sure the directories containing these dlls are granted the necessary permissions.

Q. I get an error saying "can't find php5ts.dll."
A. The current php_mdPhonePHPWrapper.dll was compiled using PHP 5.2.6. You are probably using another version of
PHP that is not compatible. You will need another version of php_mdPhonePHPWrapper.dll that uses the version of PHP 
on your system. Please look in the "Source" folder and read the readme for instructions. 


COPYRIGHT NOTICE

(C) 2014 Melissa Data Corporation. All rights reserved.
